package demo.entity;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;


public class Order {
	private int id;
	private Timestamp date;
	private double price;
	private int status;
	
	public Order() {
		
	}
	
	public Order(double price, int status) {
		java.util.Date d = new java.util.Date();
		this.date = new Timestamp(d.getTime());
		this.id = 0;
		this.price = price;
		this.status = status;
	}
	
	public Order(int id, Timestamp date, double price, int status) {
		this.id = id;
		this.date = date;
		this.price = price;
		this.status = status;
	}
	
	public int getId() {
		return id;
	}
	
	public Timestamp getDate() {
		return date;
	}
	
	public double getPrice() {
		return price;
	}
	
	public int getStatus() {
		return status;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public void setDate(Timestamp date) {
		this.date = date;
	}
	
	public void setPrice(double price) {
		this.price = price;
	}
	
	public void setStatus(int status) {
		this.status = status;
	}
	
	@Override
	public String toString() {
		StringBuffer stringBuffer = new StringBuffer();
		SimpleDateFormat sdformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		stringBuffer.append(String.format("%s,%s,%s,%s", id, sdformat.format(date), String.valueOf(price), String.valueOf(status)));
		return stringBuffer.toString();
	}
}
